﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using FluentValidation;
using CashFlow.ShopManage.Models.User;

namespace CashFlow.ShopManage.Validator.User
{
    public class UpdateUserStateModelValidator
        : AbstractValidator<UpdateUserStateModel>
    {
        public UpdateUserStateModelValidator()
        {
            CascadeMode = CascadeMode.Stop;
            RuleFor(x => x.UserId).Must(x => ValidatorTool.IsUserBelongsMyShop(x))
                .WithMessage("非法UserId");
            RuleFor(x => x.State).Must(x => x == 0 || x == 1)
                .WithMessage("非法State");
        }
    }
}